До Python 3.5 объекты datetime.time() считались ложными, если они представляли полночь по UTC. Это могло приводить к трудноуловимым ошибкам. В следующих примерах if not может выполниться не потому, что created_time равен None, а потому, что время — полночь.
def create(created_time=None) -> None: if not created_time: created_time = datetime.now().time()
Можно исправить это, явно проверяя на None:
def create(created_time=None) -> None: if created_time is None: created_time = datetime.now().time()
До Python 3.5 объекты datetime.time() считались ложными, если они представляли полночь по UTC. Это могло приводить к трудноуловимым ошибкам. В следующих примерах if not может выполниться не потому, что created_time равен None, а потому, что время — полночь.
def create(created_time=None) -> None: if not created_time: created_time = datetime.now().time()
Можно исправить это, явно проверяя на None:
def create(created_time=None) -> None: if created_time is None: created_time = datetime.now().time()
Telegram is riding high, adding tens of million of users this year. Now the bill is coming due.Telegram is one of the few significant social-media challengers to Facebook Inc., FB -1.90% on a trajectory toward one billion users active each month by the end of 2022, up from roughly 550 million today.
How Does Bitcoin Mining Work?
Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.
Библиотека Python разработчика | Книги по питону from tw